<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../vue.js"></script>
</head>

<body>
    <div id="app">

    </div>
    <script>
        Vue.config.productionTip = false
        let number = 18
        let person = {
            name: '张三',
            sex: '男',
            // age: number
        }
        Object.defineProperty(person, 'age', {
            // value: 18,
            // enumerable: true, //控制是否能枚举
            // writable: true, //控制是否能修改
            // configurable: true //控制是否能删除
            get: function() {
                console.log('Got age');
                return number
            },
            set: function(value) {
                console.log('Set age');
                number = value
            }
        })

        console.log(person);
        const vm = new Vue({
            data() {
                return {

                }
            }
        })
        vm.$mount('#app')
    </script>
</body>

</html>